package cn.edu.fzu.delivery.domain.enums;

/**
 * @author jiebin
 * @data 2022/11/13
 **/
public enum DeliveryStatusEnum implements SpringConvertibleEnum {
    FAIL(-1, "派送失败"),
    WAIT(0, "待取件"),
    DELIVERING(1, "派送中"),
    DELIVERED(2, "派送完成");

    private final int    value;

    private final String desc;

    private DeliveryStatusEnum(int value, String desc) {
        this.value = value;
        this.desc = desc;
    }


    public int getValue() {
        return value;
    }


    public String getDesc() {
        return desc;
    }


    public static DeliveryStatusEnum parse(int value) {
        switch (value) {
            case -1:
                return FAIL;
            case 0:
                return WAIT;
            case 1:
                return DELIVERING;
            case 2:
                return DELIVERED;
            default:
                return null;
        }
    }


    @Override
    public String toString() {
        return String.valueOf(getValue());
    }
}
